]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
calendar: Simplify placeholder
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 18 Dec 2018 10:20:42 +0000 (11:20 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 5 Jun 2020 23:04:09 +0000 (01:04 +0200)
Without the events section in the message list, the placeholder can only
reflect whether or not there are notifications.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1282

js/ui/calendar.js

index 7eb4519166029f09476ccabd6c6bc2f0e8293cd5..ef3a282404ad1b559867bbfe01a53156fe783039 100644 (file)
@@ -31,10 +31,6 @@ function sameDay(dateA, dateB) {
     return sameMonth(dateA, dateB) && (dateA.getDate() == dateB.getDate());
 }
 
-function isToday(date) {
-    return sameDay(new Date(), date);
-}
-
 function _isWorkDay(date) {
     /* Translators: Enter 0-6 (Sunday-Saturday) for non-work days. Examples: "0" (Sunday) "6" (Saturday) "06" (Sunday and Saturday). */
     let days = C_('calendar-no-work', "06");
@@ -891,41 +887,13 @@ class Placeholder extends St.BoxLayout {
         super._init({ style_class: 'message-list-placeholder', vertical: true });
         this._date = new Date();
 
-        let todayFile = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/no-notifications.svg');
-        let otherFile = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/no-events.svg');
-        this._todayIcon = new Gio.FileIcon({ file: todayFile });
-        this._otherIcon = new Gio.FileIcon({ file: otherFile });
-
-        this._icon = new St.Icon();
+        const file = Gio.File.new_for_uri(
+            'resource:///org/gnome/shell/theme/no-notifications.svg');
+        this._icon = new St.Icon({ gicon: new Gio.FileIcon({ file }) });
         this.add_actor(this._icon);
 
-        this._label = new St.Label();
+        this._label = new St.Label({ text: _('No Notifications') });
         this.add_actor(this._label);
-
-        this._sync();
-    }
-
-    setDate(date) {
-        if (sameDay(this._date, date))
-            return;
-        this._date = date;
-        this._sync();
-    }
-
-    _sync() {
-        let today = isToday(this._date);
-        if (today && this._icon.gicon == this._todayIcon)
-            return;
-        if (!today && this._icon.gicon == this._otherIcon)
-            return;
-
-        if (today) {
-            this._icon.gicon = this._todayIcon;
-            this._label.text = _("No Notifications");
-        } else {
-            this._icon.gicon = this._otherIcon;
-            this._label.text = _("No Events");
-        }
     }
 });
 
@@ -1064,6 +1032,5 @@ class CalendarMessageList extends St.Widget {
 
     setDate(date) {
         this._sectionList.get_children().forEach(s => s.setDate(date));
-        this._placeholder.setDate(date);
     }
 });